package com.lyz.dataStructure.algorithm.beike2020;

import java.util.Arrays;
import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/8/10 19:04
 *@Description:
 **/
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int N= sc.nextInt();
            long[] arr= new long[N];
            for(int i = 0;i<N;i++){
                arr[i] = sc.nextInt();
            }
            long min = Integer.MAX_VALUE;
            long shu = 0;
            int i =0;
            int index = 0;
            for(;i<arr.length-1;i++){
                if(Math.abs(arr[i+1]-arr[i])>0){
                    shu = Math.abs(arr[i+1]-arr[i]);
                }
                if(shu<min){
                    index = i;
                }
                min = Math.min(shu,min);
            }
            System.out.printf("%d %d",arr[index],arr[index+1]);
        }
    }
}
